/*
Wrong Answer. Because this method is only consider the max value.
But the problem's rele refers to special cases is :
"If more than one order of brown, green, and clear bins yields the minimum number of movements
 then the alphabetically first string representing a minimal configuration should be printed."
*/
#include <cstdlib>
#include <iostream>

using namespace std;

//input BGC
enum Color {
	B = 0, G = 1, C = 2
};
struct Position {
	int bin;
	Color color;
};
struct Max {
	bool isFindFirst;
	char color_in_bin[4];
	int num, bin;
	Color color;
	Position ft, sd, td;
};

char clr[3] = { 'B', 'G', 'C' };

void find_location(Max &, int[][3]);

int main() {
	int bin_color[3][3];

	while (cin >> bin_color[0][B] >> bin_color[0][G] >> bin_color[0][C]
			>> bin_color[1][B] >> bin_color[1][G] >> bin_color[1][C]
			>> bin_color[2][B] >> bin_color[2][G] >> bin_color[2][C]) {
		Max max;
		max.isFindFirst = false;
		max.color_in_bin[3] = 0;
		find_location(max, bin_color);
		int sum = 0;
		for (int i = 1; i < 3; ++i) {
			sum += bin_color[(max.ft.bin + i) % 3][max.ft.color];
			sum += bin_color[(max.sd.bin + i) % 3][max.sd.color];
			sum += bin_color[(max.td.bin + i) % 3][max.td.color];
		}
		cout << max.color_in_bin << ' ' << sum << endl;
		cout << "ft.bin: " << max.ft.bin << ", ft.color: " << max.ft.color << endl;
		cout << "sd.bin: " << max.sd.bin << ", sd.color: " << max.sd.color << endl;
		cout << "td.bin: " << max.td.bin << ", td.color: " << max.td.color << endl;
	}
	
#ifndef ONLINE_JUDGE
	system("pause");
#endif

	return 0;
}

void find_location(Max& max, int num[][3]) {
	if (!max.isFindFirst) {
		max.bin = 0;
		max.color = B;
		max.num = num[0][B];
	} else {
		max.bin = (max.ft.bin + 1) % 3;
		if (max.ft.color == 2)
			max.color = B;
		else
			max.color = (Color) ((max.ft.color + 2) % 3);
		max.num = num[max.bin][max.color];
	}
	for (int i = 0; i < 3; ++i) {
		if (max.isFindFirst && (i == max.ft.color))
			continue;

		for (int j = 0; j < 3; ++j) {
			if (max.isFindFirst && (j == max.ft.bin))
				continue;

			if (num[j][i] > max.num) {
				max.num = num[j][i];
				max.bin = j;
				max.color = (Color) i;
			}
		}
	}
	if (!max.isFindFirst) {
		max.ft.bin = max.bin;
		max.ft.color = max.color;
		max.color_in_bin[max.ft.bin] = clr[max.ft.color];
		max.isFindFirst = !max.isFindFirst;
		find_location(max, num);
	} else {
		max.sd.bin = max.bin;
		max.sd.color = max.color;
		max.color_in_bin[max.sd.bin] = clr[max.sd.color];
		switch (max.ft.bin + max.sd.bin) {
		case 1:
			max.td.bin = 2;
			break;
		case 2:
			max.td.bin = 1;
			break;
		case 3:
			max.td.bin = 0;
			break;
		}
		switch (max.ft.color + max.sd.color) {
		case 1:
			max.td.color = C;
			break;
		case 2:
			max.td.color = G;
			break;
		case 3:
			max.td.color = B;
			break;
		}
		max.color_in_bin[max.td.bin] = clr[max.td.color];
	}
}